using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Web企业级开发
{
    public class Startup
    {
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        //把服务添加进容器
        public void ConfigureServices(IServiceCollection services)
        {
            //声明 引用哪些服务 

        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        //配置请求规则（开发人员制定）
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            //      是否开发环境 如果是
            if (env.IsDevelopment())
            {
                //启用 异常信息页  系统安全
                app.UseDeveloperExceptionPage();
            }

            // 启用路由 程序员 配置规则
            app.UseRouting();

            //启用终结点
            app.UseEndpoints(endpoints =>
            {
                //访问地址 会出现什么内容
                endpoints.MapGet("/", async context =>
                {
                    //把文本写进响应里面
                    await context.Response.WriteAsync("Hello World! Liudacheng");

                    //增加一行


                    ///宿舍里 再增加了代码
                    /// 教室电脑  啊啊啊

                    /// 教室电脑
                    /// 
                });
            });
        }
    }
}
